package com.zengqingfa.designpattern.structure.proxy.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 *
 * @fileName: MyInvocationHandler
 * @author: zengqf3
 * @date: 2021-6-3 14:34
 * @description:
 */
public class MyInvocationHandler implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        //解析得到sql
        Select annotation = method.getAnnotation(Select.class);
        String sql = annotation.value()[0];
        //执行sql(模拟JDBC)
        System.out.println(sql + " executing...");
        return null;
    }
}